<?php 
require "Controller.php";
require "Model/goodsmodel.php";
class goodsController extends Controller{
	
	function __construct(){
		parent::__construct();
		$this->mod=new goodsModel;
	}
	public function listgoods(){
	
		$goodsdata=$this->mod->getgoodsList();
		$this->assign('goods',$goodsdata);
		$this->display(); 
	}
	public function goodsform(){
		$this->display();
	}
	public function addgoods(){
		$result=$this->mod->addgoodsInfo();
		if($result){
			echo "添加成功!<br>";
			echo "<a href='index.php?c=goods&m=listgoods'>如果没有跳转，请点这里跳转</a>";
		}
		else{
			echo "添加失败!<br>";
			echo "<a href='index.php?c=goods&m=listgoods'>如果没有跳转，请点这里跳转</a>";
			
		}
	}//addgoods end

	//修改视频的信息
	public function editgoods(){
		
		$data=$this->mod->getgoodsbyID();
		$this->assign('goods',$data);
		$this->display();
	}
	public function updategoods(){
		$result=$this->mod->updategoodsInfo();
		if($result==true)
		echo "更新成功！<br>";
		echo ' <a href="index.php?c=goods&m=listgoods">如果没有跳转，请点这里跳转</a>';	
	}
	public function delgoods(){
		$result=$this->mod->del();
		if($result==true)
		echo "删除成功！<br>";
		echo ' <a href="index.php?c=goods&m=listgoods">如果没有跳转，请点这里跳转</a>';	
	}

}


 ?>